import Vue from 'vue'
import VueRouter from 'vue-router'
import Footer from '@/components/footer'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: 'home'
  },
  {
    path: '/home',
    name: 'home',
    components: {
      default: () => import('@/views/home/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/shopping',
    name: 'shopping',
    components: {
      default: () => import('@/views/shopping/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/vegetables',
    name: 'vegetables',
    components: {
      default: () => import('@/views/vegetables/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/order',
    name: 'order',
    components: {
      default: () => import('@/views/order/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/user',
    name: 'user',
    components: {
      default: () => import('@/views/user/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('@/views/register/index.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/components/search.vue')
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('@/components/cart.vue')
  },
  {
    path: '/shopkind/:id',
    name: 'shopkind',
    component: () => import('@/components/shopkind.vue')
  },
  {
    path: '*',
    name: 'notfind',
    component: () => import('@/views/notfind/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
